package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.CompanyPosition;
import com.winter.service.CompanyPositionService;
import com.winter.util.Result;
@RestController
@RequestMapping("/companyposit")
public class CompanyPositionController {

	@Autowired
	private CompanyPositionService service;
	
	  
    /**
     * 发布职位
     * @param record
     * @return
     */
    @PostMapping("/insert")
    public Result insert(@RequestBody CompanyPosition record){
    	return service.insert(record);
    }
    
	/**
	 * 我的信息 应聘的职位列表
	 * 
	 * @return
	 */
    @GetMapping("/querypageuser")
    public Result queryPageUserList(Integer pageNumber, Integer pageSize, String userNo, Short jobtype){
    	return service.queryPageUserList(pageNumber, pageSize, userNo, jobtype);
    }
    
	/**
	 * 根据userNo获取已发步的职业
	 * @param pageNumber
	 * @param pageSize
	 * @param userNo
	 * @param companyLike
	 * @return
	 */
    @GetMapping("/querypagejobfunction")
    public Result queryPageJobFunctionList(Integer pageNumber, Integer pageSize, String userNo, String companyLike){
    	return service.queryPageJobFunctionList(pageNumber, pageSize, userNo, companyLike);   	
    }
    
    /**
     * 根据职位id删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    public Result delete(Long id){
    	return service.delete(id);
    }
    
    /**
     * 根据职位id修改
     * @param id
     * @return
     */
    @PutMapping("/update")
    public Result update(@RequestBody CompanyPosition record){
    	return service.update(record);
    }
	
    /**
     * 查询推荐职位列表
     * @param pageNumber
     * @param pageSize
     * @param jobFunction
     * @param companyIndustry
     * @return
     */
    @GetMapping("/querygroomlist")
    public Result queryGroomList(Integer pageNumber, Integer pageSize, String jobFunction, String id){
    	return service.queryGroomList(pageNumber, pageSize, jobFunction, id);
    }
    
    /**
     * 查询已发布的职位列表
     * @param pageNumber
     * @param pageSize
     * @param createUser
     * @return
     */
    @GetMapping("/querypoistlistby")
    public Result queryPoistListBy(Integer pageNumber, Integer pageSize,String userNo){
    	return service.queryPoistListBy(pageNumber, pageSize, userNo);
    }
}
